<?php

// class Model

class Products
{
	/*
	public $id;
	public $name;
	public $picture;
	public $price;
	public $special;
	public $selloff;
	public $publish_date;
	public $content_view;
	public $author;
	public $content_detail;
	public $hits;
	public $created;
	public $created_by;
	public $modified;
	public $modified_by;
	public $order;
	public $status;
	public $cat_id;*/
	
	var $dao;
	var $t_query;
	
	function __construct(&$dao)
	{
		if($dao != null && $dao instanceof MySQL) {
			$this->dao = $dao;
		}		
	}

	function getProducts($start=1, $rows=10)
	{
		$query = "SELECT * FROM Products ORDER BY cat_id LIMIT $start, $rows";
		$t_query = "SELECT COUNT(*) FROM Products ORDER BY cat_id LIMIT $start, $rows";
		return $this->dao->Query($query);			
	}
	
	function getTotal()
	{
		return $this->dao->QueryRow($this->t_query);
	}

	function getProduct($id)
	{
		$query = "SELECT * FROM Products WHERE id='".$id."'";
		return $this->dao->Query($query);
	}
	
	function saveProduct()
	{
				
	}
}

?>
